package com.gzy.mylog.net;

import com.gzy.mylog.model.Log;
import com.gzy.mylog.model.PageList;
import com.gzy.mylog.model.Result;
import com.gzy.mylog.model.User;
import com.gzy.mylog.net.core.XXModelCallback;
import com.gzy.mylog.net.core.XXURLUtils;

import java.util.HashMap;
import java.util.Map;

public class LogApi {


    public static void loadLog(String token,int page,int size, XXModelCallback<Result<PageList<Log>>> callback)  {

        Map<String, String> header = new HashMap<>();

        header.put("Token",token);

        Map<String, String> para = new HashMap<>();

        para.put("page",page + "");
        para.put("size",size + "");

        XXURLUtils.shared.get(NetConfig.Log.page, header,para, callback);

    }
    public static void addLog(String token,String content, XXModelCallback<Result<Log>> callback)  {

        Map<String, String> header = new HashMap<>();

        header.put("Token",token);

        Map<String, String> para = new HashMap<>();

        para.put("content",content);

        XXURLUtils.shared.post(NetConfig.Log.add, header,para, callback);

    }


    public static void updateLog(String token,Long id,String content, XXModelCallback<Result<Log>> callback)  {

        Map<String, String> header = new HashMap<>();

        header.put("Token",token);

        Map<String, String> para = new HashMap<>();

        para.put("content",content);

        XXURLUtils.shared.put(NetConfig.Log.update + "/" + id, header,para, callback);

    }

    public static void deleteLog(String token, Long id, XXModelCallback<Result<String>> callback) {
        Map<String, String> header = new HashMap<>();

        header.put("Token",token);

        Map<String, String> para = new HashMap<>();


        XXURLUtils.shared.delete(NetConfig.Log.delete + "/" + id, header,para, callback);
    }
}
